When a photographic subject is taken against the light, the image of the subject becomes an unclear backlight image with low lightness and low contrast. As a result, details of the image cannot be easily distinguished. Retinex processing is known as one of methods that increase lightness and contrast to improve not only an image taken against the light but also the quality of an overexposed or underexposed image, a blurring image, a noisy image, and an image taken under low-light intensity.
The retinex processing improves image quality of image data of a low-quality region, while maintaining unchanged image data of a high-quality region. In the retinex processing, data on each pixel of an original image is corrected by reflecting data on peripheral pixels by using a Gaussian filter. A reference component data is calculated by a natural logarithm of the corrected pixel data. An illuminance component data is calculated by dividing the pixel data of the original image by a component of the pixel data in the original image. That is, the original image data is divided into two components: the reference component and the illuminance component. After lightness and gradation (contrast) correction such as gamma correction is performed to the illuminance component, the corrected illuminance component is combined with the reference component. Thereby, it is possible to generate data on the image whose low-quality region such as a backlight image region of the original image has been improved in its quality.
When the retinex processing is individually performed for each plane of RGB values, color balance is disrupted or colors are shifted. To solve these problems, U.S. Pat. No. 6,885,482 discloses a method in which RGB values are converted into a coordinate space such as YCbCr or YIQ that is formed of a luminance component and color components. The retinex processing is applied to only the luminance component Y. The luminance component which has been subjected to the retinex processing and the color components which are maintained unchanged are converted back to RGB values. Since only the luminance component is adjusted and the color components are not adjusted, disruption of a color balance and shift in color never occurs. Because the retinex processing is performed only to the luminance component, amount of computation can be reduced and processing can be performed at a higher speed, compared to the case where the retinex processing is individually performed for each plane of RGB values.